home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Utilities / vim-5.1 / src / structs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-28  |  24.5 KB  |  761 lines

  1. /* vi:set ts=8 sts=4 sw=4:
  2.  *
  3.  * VIM - Vi IMproved    by Bram Moolenaar
  4.  *
  5.  * Do ":help uganda"  in Vim to read copying and usage conditions.
  6.  * Do ":help credits" in Vim to see a list of people who contributed.
  7.  */
  8.  
  9. /*
  10.  * This file contains various definitions of structures that are used by Vim
  11.  */
  12.  
  13. /*
  14.  * There is something wrong in the SAS compiler that makes typedefs not
  15.  * valid in include files.  Has been fixed in version 6.58.
  16.  */
  17. #if defined(SASC) && SASC < 658
  18. typedef long        linenr_t;
  19. typedef unsigned    colnr_t;
  20. typedef unsigned short    short_u;
  21. #endif
  22.  
  23. /*
  24.  * file position
  25.  */
  26. typedef struct fpos    FPOS;
  27.  
  28. struct fpos
  29. {
  30.     linenr_t        lnum;        /* line number */
  31.     colnr_t        col;        /* column number */
  32. };
  33.  
  34. /*
  35.  * Sorry to put this here, but gui.h needs the FPOS type, and WIN needs gui.h
  36.  * for GuiScrollbar.  There is probably somewhere better it could go -- webb
  37.  */
  38. #ifdef USE_GUI
  39. # include "gui.h"
  40. #else
  41. # define GuiColor int        /* avoid error message for undefined struct */
  42. #endif
  43.  
  44. /*
  45.  * marks: positions in a file
  46.  * (a normal mark is a lnum/col pair, the same as a file position)
  47.  */
  48.  
  49. #define NMARKS        26        /* max. # of named marks */
  50. #define JUMPLISTSIZE    30        /* max. # of marks in jump list */
  51. #define TAGSTACKSIZE    20        /* max. # of tags in tag stack */
  52.  
  53. struct filemark
  54. {
  55.     FPOS        mark;        /* cursor position */
  56.     int            fnum;        /* file number */
  57. };
  58.  
  59. /*
  60.  * The taggy struct is used to store the information about a :tag command.
  61.  */
  62. struct taggy
  63. {
  64.     char_u        *tagname;        /* tag name */
  65.     struct filemark fmark;        /* cursor position BEFORE ":tag" */
  66.     int            cur_match;        /* match number */
  67. };
  68.  
  69. /*
  70.  * line number list
  71.  */
  72.  
  73. /*
  74.  * Each window can have a different line number associated with a buffer.
  75.  * The window-pointer/line-number pairs are kept in the line number list.
  76.  * The list of line numbers is kept in most-recently-used order.
  77.  */
  78.  
  79. typedef struct window        WIN;
  80. typedef struct winlnum        WINLNUM;
  81.  
  82. struct winlnum
  83. {
  84.     WINLNUM    *wl_next;        /* next entry or NULL for last entry */
  85.     WINLNUM    *wl_prev;        /* previous entry or NULL for first entry */
  86.     WIN        *wl_win;        /* pointer to window that did set wl_lnum */
  87.     linenr_t     wl_lnum;        /* last cursor line in the file */
  88.     colnr_t     wl_col;        /* idem, column */
  89. };
  90.  
  91. /*
  92.  * stuctures used for undo
  93.  */
  94.  
  95. struct u_entry
  96. {
  97.     struct u_entry  *ue_next;    /* pointer to next entry in list */
  98.     linenr_t        ue_top;    /* number of line above undo block */
  99.     linenr_t        ue_bot;    /* number of line below undo block */
  100.     linenr_t        ue_lcount;    /* linecount when u_save called */
  101.     char_u        **ue_array;    /* array of lines in undo block */
  102.     long        ue_size;    /* number of lines in ue_array */
  103. };
  104.  
  105. struct u_header
  106. {
  107.     struct u_header *uh_next;    /* pointer to next header in list */
  108.     struct u_header *uh_prev;    /* pointer to previous header in list */
  109.     struct u_entry  *uh_entry;    /* pointer to first entry */
  110.     FPOS         uh_cursor;    /* cursor position before saving */
  111.     int             uh_flags;    /* see below */
  112.     FPOS         uh_namedm[NMARKS];    /* marks before undo/after redo */
  113. };
  114.  
  115. /* values for uh_flags */
  116. #define UH_CHANGED  0x01    /* b_changed flag before undo/after redo */
  117. #define UH_EMPTYBUF 0x02    /* buffer was empty */
  118.  
  119. /*
  120.  * stuctures used in undo.c
  121.  */
  122. #if SIZEOF_INT > 2
  123. # define ALIGN_LONG    /* longword alignment and use filler byte */
  124. # define ALIGN_SIZE (sizeof(long))
  125. #else
  126. # define ALIGN_SIZE (sizeof(short))
  127. #endif
  128.  
  129. #define ALIGN_MASK (ALIGN_SIZE - 1)
  130.  
  131. typedef struct m_info info_t;
  132.  
  133. /*
  134.  * stucture used to link chunks in one of the free chunk lists.
  135.  */
  136. struct m_info
  137. {
  138. #ifdef ALIGN_LONG
  139.     long_u   m_size;    /* size of the chunk (including m_info) */
  140. #else
  141.     short_u  m_size;    /* size of the chunk (including m_info) */
  142. #endif
  143.     info_t  *m_next;    /* pointer to next free chunk in the list */
  144. };
  145.  
  146. /*
  147.  * structure used to link blocks in the list of allocated blocks.
  148.  */
  149. struct m_block
  150. {
  151.     struct m_block  *mb_next;    /* pointer to next allocated block */
  152.     info_t        mb_info;    /* head of free chuck list for this block */
  153. };
  154.  
  155. /*
  156.  * Structure used for growing arrays.
  157.  * This is used to store information that only grows, is deleted all at
  158.  * once, and needs to be accessed by index.  See ga_clear() and ga_grow().
  159.  */
  160. struct growarray
  161. {
  162.     int        ga_len;            /* current number of items used */
  163.     int        ga_room;            /* number of unused items at the end */
  164.     int        ga_itemsize;        /* sizeof one item */
  165.     int        ga_growsize;        /* number of items to grow each time */
  166.     void    *ga_data;            /* pointer to the first item */
  167. };
  168.  
  169. /*
  170.  * things used in memfile.c
  171.  */
  172.  
  173. typedef struct block_hdr    BHDR;
  174. typedef struct memfile        MEMFILE;
  175. typedef long            blocknr_t;
  176.  
  177. /*
  178.  * for each (previously) used block in the memfile there is one block header.
  179.  *
  180.  * The block may be linked in the used list OR in the free list.
  181.  * The used blocks are also kept in hash lists.
  182.  *
  183.  * The used list is a doubly linked list, most recently used block first.
  184.  *    The blocks in the used list have a block of memory allocated.
  185.  *    mf_used_count is the number of pages in the used list.
  186.  * The hash lists are used to quickly find a block in the used list.
  187.  * The free list is a single linked list, not sorted.
  188.  *    The blocks in the free list have no block of memory allocated and
  189.  *    the contents of the block in the file (if any) is irrelevant.
  190.  */
  191.  
  192. struct block_hdr
  193. {
  194.     BHDR    *bh_next;        /* next block_hdr in free or used list */
  195.     BHDR    *bh_prev;        /* previous block_hdr in used list */
  196.     BHDR    *bh_hash_next;        /* next block_hdr in hash list */
  197.     BHDR    *bh_hash_prev;        /* previous block_hdr in hash list */
  198.     blocknr_t    bh_bnum;        /* block number */
  199.     char_u    *bh_data;        /* pointer to memory (for used block) */
  200.     int        bh_page_count;        /* number of pages in this block */
  201.  
  202. #define BH_DIRTY    1
  203. #define BH_LOCKED   2
  204.     char    bh_flags;        /* BH_DIRTY or BH_LOCKED */
  205. };
  206.  
  207. /*
  208.  * when a block with a negative number is flushed to the file, it gets
  209.  * a positive number. Because the reference to the block is still the negative
  210.  * number, we remember the translation to the new positive number in the
  211.  * double linked trans lists. The structure is the same as the hash lists.
  212.  */
  213. typedef struct nr_trans NR_TRANS;
  214.  
  215. struct nr_trans
  216. {
  217.     NR_TRANS    *nt_next;        /* next nr_trans in hash list */
  218.     NR_TRANS    *nt_prev;        /* previous nr_trans in hash list */
  219.     blocknr_t    nt_old_bnum;        /* old, negative, number */
  220.     blocknr_t    nt_new_bnum;        /* new, positive, number */
  221. };
  222.  
  223. /*
  224.  * Simplistic hashing scheme to quickly locate the blocks in the used list.
  225.  * 64 blocks are found directly (64 * 4K = 256K, most files are smaller).
  226.  */
  227. #define MEMHASHSIZE    64
  228. #define MEMHASH(nr)    ((nr) & (MEMHASHSIZE - 1))
  229.  
  230. struct memfile
  231. {
  232.     char_u    *mf_fname;        /* name of the file */
  233.     char_u    *mf_ffname;        /* idem, full path */
  234.     int        mf_fd;            /* file descriptor */
  235.     BHDR    *mf_free_first;        /* first block_hdr in free list */
  236.     BHDR    *mf_used_first;        /* mru block_hdr in used list */
  237.     BHDR    *mf_used_last;        /* lru block_hdr in used list */
  238.     unsigned    mf_used_count;        /* number of pages in used list */
  239.     unsigned    mf_used_count_max;  /* maximum number of pages in memory */
  240.     BHDR    *mf_hash[MEMHASHSIZE];    /* array of hash lists */
  241.     NR_TRANS    *mf_trans[MEMHASHSIZE];    /* array of trans lists */
  242.     blocknr_t    mf_blocknr_max;        /* highest positive block number + 1*/
  243.     blocknr_t    mf_blocknr_min;        /* lowest negative block number - 1 */
  244.     blocknr_t    mf_neg_count;        /* number of negative blocks numbers */
  245.     blocknr_t    mf_infile_count;    /* number of pages in the file */
  246.     unsigned    mf_page_size;        /* number of bytes in a page */
  247.     int        mf_dirty;        /* Set to TRUE if there are dirty blocks */
  248. };
  249.  
  250. /*
  251.  * things used in memline.c
  252.  */
  253. typedef struct info_pointer    IPTR;        /* block/index pair */
  254.  
  255. /*
  256.  * When searching for a specific line, we remember what blocks in the tree
  257.  * are the branches leading to that block. This is stored in ml_stack.
  258.  * Each entry is a pointer to info in a block (may be data block or pointer block)
  259.  */
  260. struct info_pointer
  261. {
  262.     blocknr_t    ip_bnum;    /* block number */
  263.     linenr_t    ip_low;        /* lowest lnum in this block */
  264.     linenr_t    ip_high;    /* highest lnum in this block */
  265.     int        ip_index;    /* index for block with current lnum */
  266. };
  267.  
  268. typedef struct memline MEMLINE;
  269.  
  270. /*
  271.  * the memline structure holds all the information about a memline
  272.  */
  273. struct memline
  274. {
  275.     linenr_t    ml_line_count;    /* number of lines in the buffer */
  276.  
  277.     MEMFILE    *ml_mfp;    /* pointer to associated memfile */
  278.  
  279. #define ML_EMPTY    1    /* empty buffer */
  280. #define ML_LINE_DIRTY    2    /* cached line was changed and allocated */
  281. #define ML_LOCKED_DIRTY    4    /* ml_locked was changed */
  282. #define ML_LOCKED_POS    8    /* ml_locked needs positive block number */
  283.     int        ml_flags;
  284.  
  285.     IPTR    *ml_stack;    /* stack of pointer blocks (array of IPTRs) */
  286.     int        ml_stack_top;    /* current top if ml_stack */
  287.     int        ml_stack_size;    /* total number of entries in ml_stack */
  288.  
  289.     linenr_t    ml_line_lnum;    /* line number of cached line, 0 if not valid */
  290.     char_u    *ml_line_ptr;    /* pointer to cached line */
  291.  
  292.     BHDR    *ml_locked;    /* block used by last ml_get */
  293.     linenr_t    ml_locked_low;    /* first line in ml_locked */
  294.     linenr_t    ml_locked_high;    /* last line in ml_locked */
  295.     int        ml_locked_lineadd;  /* number of lines inserted in ml_locked */
  296. };
  297.  
  298. #ifdef SYNTAX_HL
  299. /*
  300.  * Each keyword has one keyentry, which is linked in a hash list.
  301.  */
  302. struct keyentry
  303. {
  304.     struct keyentry *next;    /* next keyword in the hash list */
  305.     short        syn_id;    /* syntax ID for this match (if non-zero) */
  306.     short        *next_list;    /* ID list for next match (if non-zero) */
  307.     short        flags;    /* see syntax.c */
  308.     char_u        keyword[1];    /* actually longer */
  309. };
  310.  
  311. /*
  312.  * syn_state contains syntax state at the start of a line.
  313.  */
  314. struct syn_state
  315. {
  316.     struct growarray    sst_ga;        /* growarray to store syntax state */
  317.     short        *sst_next_list;    /* "nextgroup" list in this state
  318.                        (this is a copy, don't free it! */
  319.     int            sst_next_flags;    /* flags for sst_next_list */
  320. };
  321. #endif /* SYNTAX_HL */
  322.  
  323. /*
  324.  * Structure shared between syntax.c, screen.c and gui_x11.c.
  325.  */
  326. struct attr_entry
  327. {
  328.     short        ae_attr;        /* HL_BOLD, etc. */
  329.     union
  330.     {
  331.     struct
  332.     {
  333.         char_u        *start;    /* start escape sequence */
  334.         char_u        *stop;    /* stop escape sequence */
  335.     } term;
  336.     struct
  337.     {
  338.         char_u        fg_color;    /* foreground color number */
  339.         char_u        bg_color;    /* background color number */
  340.     } cterm;
  341. # ifdef USE_GUI
  342.     struct
  343.     {
  344.         GuiColor        fg_color;    /* foreground color handle */
  345.         GuiColor        bg_color;    /* background color handle */
  346.         GuiFont        font;    /* font handle */
  347.     } gui;
  348. # endif
  349.     } ae_u;
  350. };
  351.  
  352. /*
  353.  * buffer: structure that holds information about one file
  354.  *
  355.  * Several windows can share a single Buffer
  356.  * A buffer is unallocated if there is no memfile for it.
  357.  * A buffer is new if the associated file has never been loaded yet.
  358.  */
  359.  
  360. typedef struct buffer BUF;
  361.  
  362. struct buffer
  363. {
  364.     MEMLINE         b_ml;        /* associated memline (also contains
  365.                      * line count) */
  366.  
  367.     BUF            *b_next;        /* links in list of buffers */
  368.     BUF            *b_prev;
  369.  
  370.     int             b_changed;        /* 'modified': Set to TRUE if
  371.                      * something in the file has
  372.                      * been changed and not written out.
  373.                      */
  374.  
  375.     int             b_notedited;    /* Set to TRUE when file name is
  376.                      * changed after starting to edit,
  377.                      * reset when file is written out. */
  378.  
  379.     int             b_nwindows;    /* nr of windows open on this buffer */
  380.  
  381.     int             b_flags;        /* various BF_ flags */
  382.  
  383.     /*
  384.      * b_ffname has the full path of the file.
  385.      * b_sfname is the name as the user typed it.
  386.      * b_fname is the same as b_sfname, unless ":cd" has been done,
  387.      *        then it is the same as b_ffname.
  388.      */
  389.     char_u        *b_ffname;        /* full path file name */
  390.     char_u        *b_sfname;        /* short file name */
  391.     char_u        *b_fname;        /* current file name */
  392.  
  393. #ifdef USE_SNIFF
  394.     int             b_sniff;        /* file was loaded through Sniff */
  395. #endif
  396.  
  397.     int             b_fnum;        /* file number for this file. */
  398.     WINLNUM        *b_winlnum;        /* list of last used lnum for
  399.                      * each window */
  400.  
  401.     long         b_mtime;        /* last change time of original file */
  402.     long         b_mtime_read;    /* last change time when reading */
  403.  
  404.     FPOS         b_namedm[NMARKS];    /* current named marks (mark.c) */
  405.  
  406.     /* These variables are set when VIsual_active becomes FALSE */
  407.     FPOS         b_visual_start;    /* start pos of last VIsual */
  408.     FPOS         b_visual_end;    /* end position of last VIsual */
  409.     int             b_visual_mode;    /* VIsual_mode of last VIsual */
  410.  
  411.     FPOS         b_last_cursor;    /* cursor position when last unloading
  412.                        this buffer */
  413.  
  414.     /*
  415.      * Character table, only used in charset.c for 'iskeyword'
  416.      */
  417.     char         b_chartab[256];
  418.  
  419.     /*
  420.      * start and end of an operator, also used for '[ and ']
  421.      */
  422.     FPOS         b_op_start;
  423.     FPOS         b_op_end;
  424.  
  425. #ifdef VIMINFO
  426.     int             b_marks_read;    /* Have we read viminfo marks yet? */
  427. #endif /* VIMINFO */
  428.  
  429.     /*
  430.      * The following only used in undo.c.
  431.      */
  432.     struct u_header *b_u_oldhead;    /* pointer to oldest header */
  433.     struct u_header *b_u_newhead;    /* pointer to newest header */
  434.     struct u_header *b_u_curhead;    /* pointer to current header */
  435.     int             b_u_numhead;    /* current number of headers */
  436.     int             b_u_synced;    /* entry lists are synced */
  437.  
  438.     /*
  439.      * variables for "U" command in undo.c
  440.      */
  441.     char_u        *b_u_line_ptr;    /* saved line for "U" command */
  442.     linenr_t         b_u_line_lnum;    /* line number of line in u_line */
  443.     colnr_t         b_u_line_colnr;    /* optional column number */
  444.  
  445.     /*
  446.      * The following only used in undo.c
  447.      */
  448.     struct m_block   b_block_head;    /* head of allocated memory block list */
  449.     info_t        *b_m_search;    /* pointer to chunk before previously
  450.                      * allocated/freed chunk */
  451.     struct m_block  *b_mb_current;    /* block where m_search points in */
  452. #ifdef INSERT_EXPAND
  453.     int             b_scanned;        /* ^N/^P have scanned this buffer */
  454. #endif
  455.  
  456.     /*
  457.      * Options "local" to a buffer.
  458.      * They are here because their value depends on the type of file
  459.      * or contents of the file being edited.
  460.      * The "save" options are for when the paste option is set.
  461.      */
  462.     int             b_p_initialized;    /* set when options initialized */
  463.     int             b_p_ai, b_p_ro, b_p_lisp;
  464.     int             b_p_inf;        /* infer case of ^N/^P completions */
  465. #ifdef INSERT_EXPAND
  466.     char_u        *b_p_cpt;        /* 'complete', types of expansions */
  467. #endif
  468.     int             b_p_bin, b_p_eol, b_p_et, b_p_ml, b_p_tx;
  469. #ifndef SHORT_FNAME
  470.     int             b_p_sn;
  471. #endif
  472.  
  473.     long         b_p_sw, b_p_sts, b_p_ts, b_p_tw, b_p_wm;
  474.     char_u        *b_p_ff, *b_p_fo, *b_p_com, *b_p_isk;
  475.     char_u        *b_p_nf;        /* Number formats */
  476.  
  477.     /* saved values for when 'bin' is set */
  478.     long         b_p_wm_nobin, b_p_tw_nobin;
  479.     int             b_p_ml_nobin, b_p_et_nobin;
  480.  
  481.     /* saved values for when 'paste' is set */
  482.     int             b_p_ai_save, b_p_lisp_save;
  483.     long         b_p_tw_save, b_p_wm_save, b_p_sts_save;
  484.  
  485. #ifdef SMARTINDENT
  486.     int             b_p_si, b_p_si_save;
  487. #endif
  488. #ifdef CINDENT
  489.     int             b_p_cin;        /* use C progam indent mode */
  490.     int             b_p_cin_save;  /* b_p_cin saved for paste mode */
  491.     char_u        *b_p_cino;        /* C progam indent mode options */
  492.     char_u        *b_p_cink;        /* C progam indent mode keys */
  493. #endif
  494. #if defined(CINDENT) || defined(SMARTINDENT)
  495.     char_u        *b_p_cinw;        /* words extra indent for 'si' and 'cin' */
  496. #endif
  497.     /* end of buffer options */
  498.  
  499.     int             b_start_ffc;   /* first char of 'ff' when edit started */
  500.  
  501. #ifdef WANT_EVAL
  502.     struct growarray b_vars;        /* internal variables, local to buffer */
  503. #endif
  504.  
  505.     /* When a buffer is created, it starts without a swap file.  b_may_swap is
  506.      * then set to indicate that a swap file may be opened later.  It is reset
  507.      * if a swap file could not be opened.
  508.      */
  509.     int             b_may_swap;
  510.     int             b_did_warn;    /* Set to 1 if user has been warned on
  511.                      * first change of a read-only file */
  512.     int             b_help;        /* buffer for help file */
  513.  
  514. #ifndef SHORT_FNAME
  515.     int             b_shortname;   /* this file has an 8.3 file name */
  516. #endif
  517.  
  518. #ifdef HAVE_PERL_INTERP
  519.     void        *perl_private;
  520. #endif
  521.  
  522. #ifdef HAVE_PYTHON
  523.     void        *python_ref;    /* The Python value referring to
  524.                      * this buffer */
  525. #endif
  526.  
  527. #ifdef SYNTAX_HL
  528.     struct keyentry    **b_keywtab;          /* syntax keywords hash table */
  529.     struct keyentry    **b_keywtab_ic;          /* idem, ignore case */
  530.     int            b_syn_ic;          /* ignore case for :syn cmds */
  531.     struct growarray    b_syn_patterns;          /* table for syntax patterns */
  532.     int            b_syn_sync_flags;     /* flags about how to sync */
  533.     short        b_syn_sync_id;          /* group to sync on */
  534.     long        b_syn_sync_minlines;  /* minimal sync lines offset */
  535.     long        b_syn_sync_maxlines;  /* maximal sync lines offset */
  536.     char_u        *b_syn_linecont_pat;  /* line continuation pattern */
  537.     vim_regexp        *b_syn_linecont_prog; /* line continuation program */
  538.     int            b_syn_linecont_ic;    /* ignore-case flag for above */
  539. /*
  540.  * b_syn_states[] contains the state stack for a number of consecutive lines,
  541.  * for the start of that line (col == 0).
  542.  * Each position in the stack is an index in b_syn_patterns[].
  543.  * Normally these are the lines currently being displayed.
  544.  * b_syn_states         is a pointer to an array of struct syn_state.
  545.  * b_syn_states_len  is the number of entries in b_syn_states[].
  546.  * b_syn_states_lnum is the first line that is in b_syn_states[].
  547.  * b_syn_change_lnum is the lowest line number with changes since the last
  548.  *             update of b_syn_states[] (0 means no changes)
  549.  */
  550.     struct syn_state    *b_syn_states;
  551.     int            b_syn_states_len;
  552.     linenr_t        b_syn_states_lnum;
  553.     linenr_t        b_syn_change_lnum;
  554. #endif /* SYNTAX_HL */
  555.  
  556. };
  557.  
  558. /*
  559.  * Structure which contains all information that belongs to a window
  560.  *
  561.  * All row numbers are relative to the start of the window, except w_winpos.
  562.  */
  563. struct window
  564. {
  565.     BUF        *w_buffer;        /* buffer we are a window into */
  566.  
  567.     WIN        *w_prev;        /* link to previous window (above) */
  568.     WIN        *w_next;        /* link to next window (below) */
  569.  
  570.     FPOS    w_cursor;        /* cursor's position in buffer */
  571.  
  572.     /*
  573.      * w_valid is a bitfield of flags, which indicate if specific values are
  574.      * valid or need to be recomputed.    See screen.c for values.
  575.      */
  576.     int        w_valid;
  577.     FPOS    w_valid_cursor;        /* last known position of w_cursor, used
  578.                        to adjust w_valid */
  579.     colnr_t    w_valid_leftcol;    /* last known w_leftcol */
  580.  
  581.     /*
  582.      * w_wrow and w_wcol are the cursor's position in the window.
  583.      * This is related to character positions in the window, not in the file.
  584.      * w_wrow is relative to w_winpos.
  585.      */
  586.     int        w_wrow, w_wcol;        /* cursor's position in window */
  587.  
  588.     /*
  589.      * w_cline_height is the number of physical lines taken by the buffer line
  590.      * that the cursor is on.  We use this to avoid extra calls to plines().
  591.      */
  592.     int        w_cline_height;        /* current size of cursor line */
  593.  
  594.     int        w_cline_row;        /* starting row of the cursor line */
  595.  
  596.     colnr_t    w_virtcol;        /* column number of the file's actual */
  597.                     /* line, as opposed to the column */
  598.                     /* number we're at on the screen. */
  599.                     /* This makes a difference on lines */
  600.                     /* which span more than one screen */
  601.                     /* line or when w_leftcol is non-zero */
  602.  
  603.     colnr_t    w_curswant;        /* The column we'd like to be at. */
  604.                     /* This is used to try to stay in */
  605.                     /* the same column through up/down */
  606.                     /* cursor motions. */
  607.  
  608.     int        w_set_curswant;        /* If set, then update w_curswant */
  609.                     /* the next time through cursupdate() */
  610.                     /* to the current virtual column */
  611.  
  612.     /*
  613.      * the next three are used to update the visual part
  614.      */
  615.     linenr_t    w_old_cursor_lnum;  /* last known end of visual part */
  616.     colnr_t    w_old_cursor_fcol;  /* first column for block visual part */
  617.     colnr_t    w_old_cursor_lcol;  /* last column for block visual part */
  618.     linenr_t    w_old_visual_lnum;  /* last known start of visual part */
  619.     colnr_t    w_old_curswant;        /* last known value of Curswant */
  620.  
  621.     linenr_t    w_topline;        /* number of the line at the top of
  622.                      * the screen */
  623.     linenr_t    w_botline;        /* number of the line below the bottom
  624.                      * of the screen */
  625.     int        w_empty_rows;        /* number of ~ rows in window */
  626.  
  627.     int        w_winpos;        /* row of topline of window in screen */
  628.     int        w_height;        /* number of rows in window, excluding
  629.                     status/command line */
  630.     int        w_status_height;    /* number of status lines (0 or 1) */
  631.  
  632.     int        w_redr_status;        /* if TRUE status line must be redrawn */
  633.     int        w_redr_type;        /* type of redraw to be performed on win */
  634.  
  635.     /* remember what is shown in the ruler for this window (if 'ruler' set) */
  636.     FPOS    w_ru_cursor;        /* cursor position shown in ruler */
  637.     colnr_t    w_ru_virtcol;        /* virtcol shown in ruler */
  638.     char    w_ru_empty;        /* TRUE if ruler shows 0-1 (empty line) */
  639.  
  640.     colnr_t    w_leftcol;        /* starting column of the screen */
  641.  
  642. /*
  643.  * The height of the lines currently in the window is remembered
  644.  * to avoid recomputing it every time. The number of entries is Rows.
  645.  */
  646.     int        w_lsize_valid;        /* nr. of valid LineSizes */
  647.     linenr_t    *w_lsize_lnum;        /* array of line numbers for w_lsize */
  648.     char_u    *w_lsize;        /* array of line heights */
  649.  
  650.     int        w_alt_fnum;        /* alternate file (for # and CTRL-^) */
  651.  
  652.     int        w_arg_idx;        /* current index in argument list */
  653.     int        w_arg_idx_invalid;  /* editing another file then w_arg_idx */
  654.  
  655.     /*
  656.      * Variables "local" to a window.
  657.      * They are here because they influence the layout of the window or
  658.      * depend on the window layout.
  659.      */
  660.     int        w_p_list,
  661.         w_p_nu,
  662. #ifdef RIGHTLEFT
  663.         w_p_rl,
  664. #ifdef FKMAP
  665.         w_p_pers,    /* for the window dependent Farsi functions */
  666. #endif
  667. #endif
  668.         w_p_wrap,
  669.         w_p_lbr;
  670.     long    w_p_scroll;
  671.  
  672. #ifdef WANT_EVAL
  673.     struct growarray w_vars;        /* internal variables, local to window */
  674. #endif
  675.  
  676.     /*
  677.      * The w_prev_pcmark field is used to check whether we really did jump to
  678.      * a new line after setting the w_pcmark.  If not, then we revert to
  679.      * using the previous w_pcmark.
  680.      */
  681.     FPOS    w_pcmark;        /* previous context mark */
  682.     FPOS    w_prev_pcmark;        /* previous w_pcmark */
  683.  
  684.     /*
  685.      * the jumplist contains old cursor positions
  686.      */
  687.     struct filemark w_jumplist[JUMPLISTSIZE];
  688.     int            w_jumplistlen;        /* number of active entries */
  689.     int            w_jumplistidx;        /* current position */
  690.  
  691.     /*
  692.      * the tagstack grows from 0 upwards:
  693.      * entry 0: older
  694.      * entry 1: newer
  695.      * entry 2: newest
  696.      */
  697.     struct taggy    w_tagstack[TAGSTACKSIZE];    /* the tag stack */
  698.     int            w_tagstackidx;        /* idx just below activ entry */
  699.     int            w_tagstacklen;        /* number of tags on stack */
  700.  
  701.     /*
  702.      * w_fraction is the fractional row of the cursor within the window, from
  703.      * 0 at the top row to FRACTION_MULT at the last row.
  704.      * w_prev_fraction_row was the actual cursor row when w_fraction was last
  705.      * calculated.
  706.      */
  707.     int            w_fraction;
  708.     int            w_prev_fraction_row;
  709.  
  710. #ifdef USE_GUI
  711.     GuiScrollbar    w_scrollbars[2];        /* Scrollbars for this window */
  712. #endif /* USE_GUI */
  713.  
  714. #ifdef HAVE_PERL_INTERP
  715.     void        *perl_private;
  716. #endif
  717.  
  718. #ifdef HAVE_PYTHON
  719.     void        *python_ref;    /* The Python value referring to
  720.                      * this window */
  721. #endif
  722. };
  723.  
  724. /*
  725.  * Arguments for operators.
  726.  */
  727. typedef struct oparg
  728. {
  729.     int        op_type;        /* current pending operator type */
  730.     int        op_prechar;        /* optional character before operator command */
  731.     int        regname;        /* register to use for the operator */
  732.     int        motion_type;    /* type of the current cursor motion */
  733.     int        inclusive;        /* TRUE if char motion is inclusive (only
  734.                    valid when motion_type is MCHAR */
  735.     int        end_adjusted;    /* backuped b_op_end one char (only used by
  736.                    do_format()) */
  737.     FPOS    start;        /* start of the operator */
  738.     FPOS    end;        /* end of the operator */
  739.     long    line_count;        /* number of lines from op_start to op_end
  740.                    (inclusive) */
  741.     int        empty;        /* op_start and op_end the same (only used by
  742.                    do_change()) */
  743.     int        is_VIsual;        /* operator on Visual area */
  744.     int        block_mode;        /* current operator is Visual block mode */
  745.     colnr_t start_vcol;        /* start col for block mode operator */
  746.     colnr_t end_vcol;        /* end col for block mode operator */
  747. } OPARG;
  748.  
  749. /*
  750.  * Arguments for Normal mode commands.
  751.  */
  752. typedef struct cmdarg
  753. {
  754.     OPARG   *oap;        /* Operator arguments */
  755.     int        prechar;        /* prefix character (optional, always 'g') */
  756.     int        cmdchar;        /* command character */
  757.     int        nchar;        /* next character (optional) */
  758.     long    count0;        /* count, default 0 */
  759.     long    count1;        /* count, default 1 */
  760. } CMDARG;
  761.